#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
	int arr[100];
	int count = 0;
	for (int i = 0; i < 100; i++)
	{
		scanf("%d", &arr[i]);
		if (arr[i] == 0)
		{
			break;
		}
		else
		{
			count++;
		}
	}
	for(int j = count-1; j >= 0; j--)
	{
		printf("%d ", arr[j]);
	}
	return 0;
}